package cn.edu.imnu.vacate.users.pojo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import cn.edu.imnu.vacate.users.enums.ARoleEnum;

/**
 * 角色表的实体类
 * @author MCR
 *
 */
public class ARole
{
	private int id;
	private String name;
	private String content;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;
	/*状态*/
	private String statusStr;

	/*关联关系*/
	private List<AUser> userList = new ArrayList<AUser>();
	
	
	
	public int getId()
	{
		return id;
	}
	public void setId(int id)
	{
		this.id = id;
	}
	public String getName()
	{
		return name;
	}
	public void setName(String name)
	{
		this.name = name;
	}
	
	public Date getCreateTime()
	{
		return createTime;
	}
	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}
	public Date getUpdateTime()
	{
		return updateTime;
	}
	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}
	public Date getPubTime()
	{
		return pubTime;
	}
	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}
	public List<AUser> getUserList()
	{
		return userList;
	}
	public void setUserList(List<AUser> userList)
	{
		this.userList = userList;
	}
	public byte getStatus()
	{
		return status;
	}
	public void setStatus(byte status)
	{
		this.status = status;
	}
	public String getStatusStr()
	{
		/**
		 * 状态：0 禁用；1启用；
		 */
		ARoleEnum[] roleEnums = ARoleEnum.values();
		for (int i = 0; i < roleEnums.length; i++)
		{
			ARoleEnum roleEnum = roleEnums[i];
			if(roleEnum.toString().startsWith("STATUS"))
			{
				if(roleEnum.getStatus() == this.status)
				{
					this.statusStr = roleEnum.getInfo();
					/*
					 * 提高效率；
					 * 数据库中存储的值肯定是枚举中 的一个值
					 */
					break;
				}
			}
		}
		return statusStr;
	}
	public String getContent()
	{
		return content;
	}
	public void setContent(String content)
	{
		this.content = content;
	}
	
}
